<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button onclick="getJSON()">测试链接</button>
    <!--TODO: 把从服务器接口获取到的数据，绑定到当前页面的表中-->
    <script lang="javascript">
        //创建userinfo对象
        function UserInfo(userId,userName,userPwd,userRole){
            this.userId=userId;
            this.userName=userName;
            this.userPwd=userPwd;
            this.userRole=userRole;
        }
        UserInfo.prototype={
            constructor:UserInfo,
            toString:function(){
                return "userId : "+this.userId+", userName : "+this.userName+", userPwd : "+this.userPwd+", userRole : "+this.userRole;
            }
        }
        var userInfos;
        //访问webapi
        function getJSON(){
            fetch('http://localhost:58888/api/userinfo/getall')
                .then(response => response.json())
                .then(json => console.log(json))
                //.then(userInfos=>JSON.parse(json))
                .catch(err => console.log('Request Failed', err)); 
        }
    </script>
</body>
</html>